package com.lesports.qmt.sbc.vo;

import com.lesports.qmt.mvc.QmtVo;
import com.lesports.qmt.sbc.model.News;
import org.apache.commons.beanutils.LeBeanUtils;

import java.lang.reflect.InvocationTargetException;

public class NewsVo extends News implements QmtVo {

    private static final long serialVersionUID = 2570124937429257253L;

    public NewsVo() {
    }

    public NewsVo(News news) {
        try {
            LeBeanUtils.copyProperties(this, news);
        } catch (IllegalAccessException | InvocationTargetException e) {
        }
    }


    public News toNews() {
        //直接用类型转换得到的对象会报序列化错误
        News news = new News();
        try {
            LeBeanUtils.copyProperties(news, this);
        } catch (IllegalAccessException | InvocationTargetException e) {
        }
        return news;
    }

}
